import React, { Component } from 'react'
import { connect} from 'react-redux'
 class xq extends Component {
    render() {
        let {query}=this.props.location
        return (
            <div>    
               <p>{query.w}</p>
                <button onClick={this.dian.bind(this,query)}>收藏</button>
                <button onClick={this.ji.bind(this,query)}>优惠价</button>
            </div>
        )
    }
    dian(query){
        this.props.cun(query)
    }
    ji(query){
        this.props.cuncun(query)
    console.log(query)
    }
}    
export default connect (
    null,
    (dispatch)=>{
        return{
            cun(data){
                dispatch({type:'CUN',data})
            },
            cuncun(type){
                dispatch({type:'CUNCUN',type})
            }
        }
    }
)(xq)